package com.bing.bean;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

/**
 * Created by kaibb on 15-10-14.
 */
@Aspect
public class Aop {

    @Pointcut(value = "execution(* *.helloAop(..))")
    public void test() {

    }

    @Before(value = "test()")
    public void beforeExecute() {
        System.out.println("beforeExecute");
    }

    @After(value = "test()")
    public void afterExectue() {
        System.out.println("afterExecute");
    }

    @Around(value = "test()")
    public void aroundExecute(ProceedingJoinPoint joinPoint) {
        System.out.println("around before joinPoint");
        try {
            joinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }

}
